define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'user/index',
        add_url: 'user/add',
        edit_url: 'user/edit',
        delete_url: 'user/delete',
        export_url: 'user/export',
        modify_url: 'user/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},                    {field: 'id', title: 'id'},                    {field: 'pid', title: 'pid'},                    {field: 'avatar', title: '头像', templet: ea.table.image},                    {field: 'nickname', title: 'nickname'},                    {field: 'openid', title: 'openid'},                    {field: 'balance', title: '余额'},                    {field: 'qrcode', title: '分销二维码', templet: ea.table.image},                    {field: 'zfb_account', title: '支付宝账号'},                    {field: 'sign_time', title: '上次签到时间'},                    {field: 'sign_day', title: '已签到天数'},                    {field: 'is_member', search: 'select', selectList: ["非会员","会员"], title: '会员状态'},                    {field: 'maturity_time', title: '到期时间'},                    {field: 'is_block', search: 'select', selectList: ["未拉黑","已拉黑"], title: '状态'},                    {field: 'p_leader', title: '上级团长id'},                    {field: 'create_time', title: '创建时间'},                    {width: 250, title: '操作', templet: ea.table.tool},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});